package cn.itsource.ymcc.feign.fallback;

import cn.itsource.ymcc.feign.CourseFeign;
import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class CourseFeignFallbackFactory implements FallbackFactory<CourseFeign> {
    @Override
    public CourseFeign create(Throwable throwable) {
        return new CourseFeign() {
            @Override
            public JsonResult selectRecord(Long courseId, Long loginId) {
                return JsonResult.error("获取数据失败");
            }

            @Override
            public JsonResult getCourseByIds(List<Long> ids) {
                return JsonResult.error("获取数据失败");
            }
        };
    }
}
